//
//  BaseViewModel.swift
//  CWLiving
//
//  Created by 方正刚 on 2017/7/13.
//  Copyright © 2017年 方正刚. All rights reserved.
//

import UIKit

class BaseViewModel: NSObject {
    
    lazy var anchorGroups = [AnchorGroupModel]()
    
}


extension BaseViewModel {
    
    func loadAnchorData(URLSrting: String, paramters: [String : Any]? = nil, finishedCallBack:@escaping ()->()) {
        
        NetworkTools.requestData(type: .GET, URLSrting: URLSrting) { (result) in
            
            guard let dataDic = result as? [String : NSObject] else {return}
            
            guard let dataArr = dataDic["data"] as? [[String : NSObject]] else {return}
            
            for dic in dataArr {
                
                self.anchorGroups.append(AnchorGroupModel(dict: dic))
                
            }
            
            finishedCallBack()
        }

        
    }
    
    
}
